package com.shoponline.util;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

public class TypeConversionTools {

	public static String timestamp2String(java.sql.Timestamp timestamp){
		
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式，不显示毫秒
		String str = df.format(timestamp);
		return str;
		
	}
	
	public static java.sql.Timestamp String2timestamp(String str){
		
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Timestamp ts = Timestamp.valueOf(str);
		return ts;
		
	} 
	
}
